/**
 * 数组排序并找出元素索引
 * @param arr
 * @param num
 * @returns {*}
 */
function where(arr, num) {
    arr.push(num);
    arr.sort(function (a,b) {
       return a-b;
    });

    return arr.indexOf(num);
}


where([40, 60], 50);
console.log(where([40, 60], 50));